package pri.black.garden.biz;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import pri.black.garden.domain.Vegetables;
import pri.black.garden.service.IVegetablesService;

/**
 * gardenBiz业务层处理
 * 
 * @author black
 * @date 2025-01-21
 */
@Service
public class VegetablesBiz
{
    @Autowired
    private IVegetablesService vegetablesService;

    public IVegetablesService getService(){
        return vegetablesService;
    }

    /**
     * 新增Vegetables
     */
    public boolean save(Vegetables vegetables){
        return vegetablesService.save(vegetables);//看情况提取至controller中
    }

    public boolean hasName(String name) {
        return vegetablesService.lambdaQuery().eq(Vegetables::getName, name).count() > 0;
    }

    /**
     * 更新Vegetables
     */
    public boolean update(Vegetables vegetables){
        return vegetablesService.updateById(vegetables);
    }
}
